package com.example.forum.dao;

import com.example.forum.model.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ArticleMapper {
    int insert(Article article);

    int insertSelective(Article article);

    Article selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Article article);

    int updateByPrimaryKeyWithBLOBs(Article article);

    int updateByPrimaryKey(Article article);

    /**
     * @return java.util.List<com.example.forum.model.Article>
     * @Description 查询所有的帖子列表
     */
    List<Article> selectAll();


    /**
     * @param boardId 板块 Id
     * @return java.util.List<com.example.forum.model.Article>
     * @Description 根据板块 Id 查询帖子列表
     */
    List<Article> selectAllByBoardId(@Param("boardId") Long boardId);

    /**
     * Created by hanzishuai on 2025/4/10
     *
     * @param id 帖子 Id
     * @return com.example.forum.model.Article
     * @Description 根据帖子 Id 返回帖子详情
     */
    Article selectDetailById(@Param("id") Long id);


    /**
     * Created by hanzishuai on 2025/4/12
     * @param userId  用户 Id
     * @return java.util.List<com.example.forum.model.Article>
     * @Description      根据用户 Id 查询帖子列表
     */
    List<Article> selectByUserId(@Param("userId") Long userId);


    /**
     * Created by hanzishuai on 2025/5/6
     * @param keyword
     * @return com.example.forum.common.AppResult<java.util.List<com.example.forum.model.Article>>
     * @Description
     */
    List<Article> search(@Param("keyword") String keyword);


}














